{% load cctags %}
{% autoescape off %}

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title>{% if subtitle %}{{subtitle }} - {% endif %}MagiCycles 迈记网</title>
        <meta content="自行车,骑行路线,骑手,俱乐部,bicycle,ride,team,bike" name="keywords"/>
        <meta content="记录并分享骑行路线,create and share your routes and rides" name="description"/>
        <link type="text/css" rel="stylesheet" href="/static/styles/default.css"/>
        {% block css %}
        {% endblock %}
    {% if option.enable_gmap %}
        <script type="text/javascript"
                src="https://{%ifequal lang 'zh-cn'%}www.google.cn/jsapi{% else %}www.google.com/jsapi{% endifequal %}">
        </script>
        <script type="text/javascript"
        src="{%ifequal lang 'zh-cn'%}http://maps.google.com{% else %}http://maps.google.com{% endifequal %}/maps/api/js?{%if option.enable_gmap_geometry%}libraries=geometry&{%endif%}sensor=false&language={{lang}}"></script>
    {% endif %}

        <script type="text/javascript" language="javascript" src="/static/js/menu.js"></script>
    {% if site_settings.development %}
        <script type="text/javascript" src="/static/js/jquery-1.8.3.min.js"></script>
    {% else %}
        <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.3.min.js"></script>
    {% endif %}
    {% block scripts %}
    {% endblock %}
        <script type="text/javascript">
            $(document).ready(function() {
                $("#site_units").change(function(){
                    window.location = "{% url views.index %}?unit="+$(this).attr('value');
                });
                
                menuSlider.init('menu','slide');
                $.ajaxSetup({
                    timeout: 60000
                });
            });
        </script>
    </head>
    <body>
        <div id="body">
            <div id="header">
                <div id="logo">
                    <a href="{% url views.index %}"><img src="/static/images/logo_200_50.png" alt="MagiCycles 迈记网"/></a>
                </div>
                <div id="commandpanel">
                    <ul>
                        <li>
                            <a href="{% url views.index %}?lang=zh-cn"> 中文 </a> | <a href="{% url views.index %}?lang=en-us"> English </a>
                        </li>
                        {% if user %}
                        <li>
                            {% _ "Welcome Back" %} <a href="{% url riders.ridersviews.editprofile user.uid %}">{{user.name}}</a>
                            @{% _ outsiteuser.site  %}
                        </li>
                        <li>
                            <a href="{% url views.logout %}" class="topbutton">{% _ "Logout" %}</a>
                        </li>
                        {% else %}
                        <li>
                            <a href="{% url views.login %}" class="topbutton">{% _ "Login" %}</a>
                        </li>
                        <li>
                            <a href="{% url riders.ridersviews.joinus %}" class="topbutton">{% _ "Join Now" %}</a>
                        </li>
                        {% endif %}
                        <li>{% _ "Units" %}:
                            <select id="site_units" name="site_units">
                                {% for u in unit.units %}
                                <option {% ifeq unit.unit u %} selected="selected" {% endifeq %}
                                    value="{{u}}"> {% _ u %} </option>
                                {% endfor %}
                            </select>
                        </li>
                    </ul>
                </div>
                <div id="donate_top"><a href="{% url views.donate %}" target="_blank">{% _ "Donate" %}</a>
                    {% _ " to support MagiCycles running and developing."%}
                </div>
            </div>
            <div id="top_bar">
                <div class="menu">
                    <ul id="menu">
                        {% block menu %}{% endblock %}
                    </ul>
                    <div id="slide">
                    </div>
                </div>
                <div id="cmdbar">
                    <ul>
                    <li>
                    <a href="{% url routes.routesviews.createroute %}" class="cmdbutton">{% _ "Add Route" %}</a>
                    </li>
                    <li>
                    <a href="{% url routes.ridesviews.logride %}" class="cmdbutton">{% _ "Log Ride" %}</a>
                    </li>
                    {% if user %}
                    <li>
                    <a href="{% url riders.ridersviews.userpage user.uid %}" class="cmdbutton">{% _ "My Profile" %}</a>
                    </li>
                    {% endif %}
                    </ul>
                </div>
                <form action="{% url views.search %}" method="post" id="header-search">
                    <input type="text" id="search-txt" name="search-txt" placeholder="{% _ "Search for Routes and Riders" %}"
                            value="{{ search_text|escape }}"/>
                    <input type="submit" id="search-btn" value="Search" />
                </form>
            </div>
            <div class="clear">
            </div>
            <div id="main-page">
                {% block main-page %}{% endblock %}
            </div>
            <div class="clear">
            </div>
            <div class="tips">
                <div class="tips_content">
                    <ul>
                        <li>{% _ "Chrome or Firefox is recommended to access MagiCycles" %}</li>
                    </ul>
                </div>
                <a class="close" onclick="this.parentNode.style.display='none';return false;" href="javascript:void(0);">x</a>
            </div>
            <div id="footer">
                <span>
                    Copyright&copy;2011-2012 <a href="{% url views.index %}">MagiCycles 迈记网</a>.
                    <a target="_blank" href="{% url views.tos %}">{% _ "Terms of Service" %}</a> |
                    <a target="_blank" href="http://code.google.com/p/magicycle/">{% _ "Get Help" %}</a> |
                    <a target="_blank" href="http://code.google.com/p/magicycle/issues/entry">{% _ "Report Bug" %}</a> |
                    <a target="_blank" href="{% url views.donate %}">{% _ "Donate" %}</a>
                </span>
            </div>
        </div>
    </body>
</html>
{% endautoescape %}
